home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / draft-ietf-cat-ftpsec-00.txt < prev    next >
Text File  |  1993-04-06  |  35KB  |  809 lines

  1.  
  2.  
  3. Network Working Group                    Internet Engineering Task Force
  4. Internet-Draft            Common Authentication Technology Working Group
  5. Updates: RFC 959                                              S. J. Lunt
  6.                                                                 Bellcore
  7.                                                               April 1993
  8.  
  9.  
  10.                         FTP Security Extensions
  11.  
  12. Status of this Memo
  13.  
  14.    This document is an Internet  Draft.   Internet  Drafts  are  working
  15.    documents  of  the Internet Engineering Task Force (IETF), its Areas,
  16.    and its Working Groups. Note that other groups  may  also  distribute
  17.    working documents as Internet Drafts.
  18.  
  19.    Internet Drafts are draft  documents  valid  for  a  maximum  of  six
  20.    months. Internet  Drafts  may  be  updated, replaced, or obsoleted by
  21.    other documents at any time.  It is not appropriate to  use  Internet
  22.    Drafts as reference material or to cite them other than as a "working
  23.    draft" or "work in progress."
  24.  
  25.    Please check the I-D abstract  listing  contained  in  each  Internet
  26.    Draft  directory  to  learn  the  current status of this or any other
  27.    Internet Draft.
  28.  
  29.    Distribution of this memo is unlimited.  Please send comments to  the
  30.    <ftp-wg@tgv.com> mailing list.
  31.  
  32. 1. Description
  33.  
  34.    This document defines extensions to  the  FTP  specification  RFC959,
  35.    "FILE  TRANSFER  PROTOCOL (FTP)" (October 1985), which provide strong
  36.    authentication, integrity, and confidentiality on  both  the  control
  37.    and  data  channels  with  the introduction of new optional commands,
  38.    replies, and file transfer encodings.
  39.  
  40.    The  following  new  optional  commands  are   introduced   in   this
  41.    specification:
  42.  
  43.       AUTH  (Authentication  Type),  ADAT  (Authentication  Data),   MIC
  44.       (Integrity  Protected  Command),  ENC (Privacy Protected Command),
  45.       and PROT (Data Channel Protection Level).
  46.  
  47.    A new class of reply types (6yz) is  also  introduced  for  protected
  48.    replies.
  49.  
  50.  
  51.  
  52.  
  53. Expires: October 31, 1993                                       [Page 1]
  54.  
  55. Internet-Draft          FTP Security Extensions               April 1993
  56.  
  57.  
  58.    None of the above commands are required to be implemented,  but  each
  59.    is dependent on the other (except ENC, which is optional).
  60.  
  61.    Note that this specification is compatible with RFC959.
  62.  
  63. 2. Motivation
  64.  
  65.    The File Transfer Protocol (FTP) currently defined in RFC959  and  in
  66.    place  on  the  Internet  uses  usernames  and  passwords  passed  in
  67.    cleartext to authenticate clients to servers (via the USER  and  PASS
  68.    commands).   Except  for  services  such as 'anonymous' FTP archives,
  69.    this represents a security  risk  whereby  passwords  can  be  stolen
  70.    through monitoring of local and wide-area networks.  This either aids
  71.    potential  attackers  through   password   exposure   and/or   limits
  72.    accessibility of files to remote users who can or will not accept the
  73.    inherent security risk.
  74.  
  75.    Aside from the problem of authenticating users in  a  secure  manner,
  76.    there  is  also  the  problem  of  protecting  sensitive  data and/or
  77.    verifying its integrity.  An attacker may be able to access  valuable
  78.    or  sensitive  data merely by monitoring a network, or through active
  79.    means may be able to delete or modify the data being  transferred  so
  80.    as  to  corrupt  its integrity.  An active attacker may also initiate
  81.    spurious file transfers to and from a site of the attacker's  choice,
  82.    and  may invoke other commands on the server.  FTP does not currently
  83.    have  any  provision  for  the  encryption  or  verification  of  the
  84.    authenticity  of  commands,  replies, or transferred data.  Note that
  85.    these security services have value even to anonymous file access.
  86.  
  87.    Current practice for sending files securely is generally either:
  88.  
  89.  
  90.      1.  via FTP of files pre-encrypted under keys  which  are  manually
  91.          distributed,
  92.  
  93.      2.  via electronic mail containing an encoding of a file  encrypted
  94.          under keys which are manually distributed,
  95.  
  96.      3.  via a PEM message, or
  97.  
  98.      4.  via the rcp command enhanced to use Kerberos.
  99.  
  100.  
  101.    None of these means could be considered even a de facto standard, and
  102.    none are truly interactive.  A need exists to securely transfer files
  103.    using FTP in a secure  manner  which  is  supported  within  the  FTP
  104.    protocol in a consistent manner and which takes advantage of existing
  105.    security infrastructure and technology.  Extensions are necessary  to
  106.    the FTP specification if these security services are to be introduced
  107.    into the protocol in an interoperable way.
  108.  
  109.  
  110.  
  111. Expires: October 31, 1993                                       [Page 2]
  112.  
  113. Internet-Draft          FTP Security Extensions               April 1993
  114.  
  115.  
  116. 3. New FTP Commands
  117.  
  118.    The following commands are optional, but  dependent  on  each  other.
  119.    They are extensions to the FTP Access Control Commands.
  120.  
  121.    AUTHENTICATION TYPE (AUTH)
  122.  
  123.       The argument field is a  Telnet  string  identifying  a  supported
  124.       authentication  mechanism.   The  command  represents a request to
  125.       perform  an  authentication  protocol   exchange   based   on   an
  126.       authentication  mechanism  identified by the argument.  Currently,
  127.       only KERBEROS_V4 and GSSAPI are defined.
  128.  
  129.       If the server accepts an authentication type with reply code  334,
  130.       then the client must next initiate an authentication exchange (via
  131.       the ADAT command) based on that authentication type.  The goal  of
  132.       the  authentication  exchange is to strongly authenticate the user
  133.       to the server, and to establish a security context [3] under which
  134.       protection of the control and data channels may be performed.
  135.  
  136.       If the server replies with a 234  code,  then  the  authentication
  137.       type  is  accepted,  and  no  ADAT commands are required.  This is
  138.       useful to indicate to the server that the password to be sent in a
  139.       subsequent  PASS  command  is  to  be interpreted differently than
  140.       normal, as in the case of  smart  cards  or  other  non-disclosing
  141.       password   systems.   Challenge  information  intended  for  human
  142.       interpretation may be contained in the  reply.   Such  information
  143.       may also be conveyed in the text of the reply to the USER command.
  144.  
  145.       If the server rejects a type (reply code 504), or any ADAT command
  146.       fails,  then  the  client  may  try another authentication type by
  147.       issuing another AUTH command, or may continue by sending USER  and
  148.       PASS  commands.   Thus,  the  client should request authentication
  149.       types in decreasing order of  preference  (i.e.,  strength).   The
  150.       server  will  reject  (with  a  503  reply  code) any AUTH or ADAT
  151.       commands  sent  after  an  authentication  protocol   successfully
  152.       completes.
  153.  
  154.       The client should not require  the  server  to  support  the  AUTH
  155.       command  or  any  particular  authentication  type.  If either the
  156.       server does not support the AUTH command (reply code 500), or  the
  157.       client  and  server  cannot agree on an authentication type, or no
  158.       authentication exchange succeeds, then the default USER  and  PASS
  159.       commands must be performed.
  160.  
  161.       The AUTH command will normally be the first command transmitted by
  162.       the  user after the control connections are made, generally before
  163.       the USER command.  However, the AUTH command may cause the control
  164.       connection  to be closed by servers which require the USER command
  165.       to be the first command transmitted by the user after the  control
  166.  
  167.  
  168.  
  169. Expires: October 31, 1993                                       [Page 3]
  170.  
  171. Internet-Draft          FTP Security Extensions               April 1993
  172.  
  173.  
  174.       connection is made.
  175.  
  176.       Some servers will require that authentication be performed  before
  177.       certain commands (including USER) will be accepted.  In this case,
  178.       a 530  reply  will  be  sent  indicating  that  an  authentication
  179.       exchange is required.
  180.  
  181.       Some authentication protocols may require prior knowledge  of  the
  182.       remote user name (e.g., some challenge/response systems).  In this
  183.       case, the USER command may be sent in advance of the AUTH command.
  184.  
  185.  
  186.    AUTHENTICATION DATA (ADAT)
  187.  
  188.       The argument field is a  Telnet  string  representing  a  base  64
  189.       encoded authentication data (see the definition of the MIC command
  190.       for a description of base 64 encoding).  The data is  specific  to
  191.       the  authentication protocol specified by a previous AUTH command.
  192.       The ADAT command, and the associated replies, allow the client and
  193.       server  to  conduct  an  arbitrary  authentication  protocol.  The
  194.       client will send authentication data to the server  via  the  ADAT
  195.       command,  and  the  server  will  send  authentication back to the
  196.       client by including "ADAT=string" in the reply,  where  string  is
  197.       also  a  Telnet string representing base 64 encoded authentication
  198.       data.  The server will reply 501 if the string could not  be  base
  199.       64 decoded.
  200.  
  201.       If the server sends a 535  reply,  then  the  authentication  data
  202.       could  not  be successfully processed, and the client has not been
  203.       authenticated.  The client may either try  another  authentication
  204.       type  by  sending  another AUTH command, or may send USER and PASS
  205.       commands.  The server will  reply  503  if  no  AUTH  command  was
  206.       previously accepted.
  207.  
  208.       If the server sends a 335 reply, then the authentication data  was
  209.       successfully  processed, but more authentication data is necessary
  210.       to complete the authentication process.  In this case, the  server
  211.       must include encoded authentication data in the reply.  The client
  212.       must process this  returned  data  and  then  issue  another  ADAT
  213.       command.
  214.  
  215.       If the server sends a  235  reply,  optionally  including  encoded
  216.       authentication   data,   then  the  server  considers  the  client
  217.       authenticated.  The client must process  any  authentication  data
  218.       present in the reply.
  219.  
  220.       Appendix I defines the actual protocol for KERBEROS_V4.   Appendix
  221.       II defines the actual protocol for GSSAPI.
  222.  
  223.       If an authentication exchange succeeds, then the client's identity
  224.  
  225.  
  226.  
  227. Expires: October 31, 1993                                       [Page 4]
  228.  
  229. Internet-Draft          FTP Security Extensions               April 1993
  230.  
  231.  
  232.       has  been  authenticated  but not yet authorized.  The client must
  233.       next invoke the USER command to identify to the server the account
  234.       (file  system) for which access is requested.  If the USER command
  235.       results in a 231 reply, then the  client  is  authorized,  and  no
  236.       password is required.  However, the client must then send the PASS
  237.       command to actually log  the  user  in  (the  actual  password  is
  238.       ignored and should be a dummy value).  If the USER command results
  239.       in a 333 reply,  then  the  user  was  not  authorized  without  a
  240.       password,  and  a password must be sent with the PASS command.  In
  241.       this case,  it  is  recommended  that  the  PASS  command  be  ENC
  242.       protected.   Additional  USER  or  PASS commands may be sent after
  243.       success of an ADAT command.
  244.  
  245.       Once the client is successfully authenticated via  AUTH  and  ADAT
  246.       commands,  the rest of the data over the control channel (commands
  247.       and replies) must  be  protected,  either  with  integrity  (by  a
  248.       cryptographic   checksum)   via   the   MIC   command,   or   with
  249.       confidentiality (by encryption) via the ENC  command.   (Also  see
  250.       the  section  on  protected  replies.)  These  two commands may be
  251.       arbitrarily intermixed.  It is up to the client to decide which of
  252.       MIC  and  ENC  commands to use, and it is up to the server when to
  253.       accept either.  The server will return a 502 reply  to  any  other
  254.       command.
  255.  
  256.       Commands sent via the  Telnet  out-of-band  signal  must  also  be
  257.       protected.   That  is,  if the client sends the Telnet "IP" signal
  258.       followed by the Telnet "Synch" signal, then the  command  sent  to
  259.       the server immediately afterwards must also protected.
  260.  
  261.       A requirement of all specifications for  authentication  exchanges
  262.       based  on  new  authentication  types  is  that they convey to the
  263.       caller whether encryption is supported on the  resultant  security
  264.       context,  since  it is not a requirement that the ENC command, 632
  265.       protected replies, or the Private protection level  be  supported.
  266.       It is also strongly suggested that per message protection services
  267.       supported by each mechanism perform  message  replay  and  out-of-
  268.       sequence  detection,  since  no  provision  for  these services is
  269.       explicitly made within this specification.
  270.  
  271.       Since no explicit provision is made in this specification for  the
  272.       negotiation  of  specific  mechanisms  for  performing per message
  273.       protection services, implementors should instead utilize the token
  274.       exchange for this purpose.
  275.  
  276.  
  277.    INTEGRITY PROTECTED COMMAND (MIC)
  278.  
  279.       The required argument is a Telnet string consisting of a  base  64
  280.       encoded  "safe"  message  produced  by an authentication mechanism
  281.       specific message integrity procedure.  The server will decode  the
  282.  
  283.  
  284.  
  285. Expires: October 31, 1993                                       [Page 5]
  286.  
  287. Internet-Draft          FTP Security Extensions               April 1993
  288.  
  289.  
  290.       received  string,  verify  its  integrity  via  the authentication
  291.       mechanism specific message integrity procedure, and upon  success,
  292.       interpret  the  resultant  string  as  an  FTP command.  The user-
  293.       process need not include the Telnet end-of-line  character  within
  294.       the encoded command.
  295.  
  296.       Base 64 encoding is the same as the Printable  Encoding  described
  297.       in Section 4.3.2.4 of [2] and is defined as follows.
  298.  
  299.       Proceeding from left to right, the bit string resulting  from  the
  300.       mechanism  specific  protection routine is encoded into characters
  301.       which are universally  representable  at  all  sites,  though  not
  302.       necessarily  with  the  same  bit  patterns  (e.g.,  although  the
  303.       character  "E"  is  represented  in  an  ASCII-based   system   as
  304.       hexadecimal  45  and  as hexadecimal C5 in an EBCDIC-based system,
  305.       the local significance of the two representations is equivalent).
  306.  
  307.       A 64-character subset  of  International  Alphabet  IA5  is  used,
  308.       enabling  6  bits to be represented per printable character.  (The
  309.       proposed subset of characters is represented  identically  in  IA5
  310.       and  ASCII.)  The  character  "="  signifies  a special processing
  311.       function used for padding within the printable encoding procedure.
  312.  
  313.       The encoding process represents 24-bit groups  of  input  bits  as
  314.       output  strings  of 4 encoded characters.  Proceeding from left to
  315.       right across a 24-bit input group extracted  from  the  output  of
  316.       step  3,  each 6-bit group is used as an index into an array of 64
  317.       printable characters, namely "[A-Z][a-z][0-9]+/".   The  character
  318.       referenced  by  the  index  is placed in the output string.  These
  319.       characters are selected so as to be universally representable, and
  320.       the set excludes characters with particular significance to Telnet
  321.       (e.g., "<CR>", "<LF>").
  322.  
  323.       Special  processing  is  performed  if  fewer  than  24  bits  are
  324.       available  in  an  input  group  at  the end of a message.  A full
  325.       encoding quantum is always completed at  the  end  of  a  message.
  326.       When  fewer  than  24  input bits are available in an input group,
  327.       zero bits are added (on the right) to form an integral  number  of
  328.       6-bit  groups.   Output character positions which are not required
  329.       to represent actual input data  are  set  to  the  character  "=".
  330.       Since  all  canonically  encoded  output  is an integral number of
  331.       octets, only the following cases can arise: (1) the final  quantum
  332.       of  encoding  input  is an integral multiple of 24 bits; here, the
  333.       final unit of encoded output will be an  integral  multiple  of  4
  334.       characters  with no "=" padding, (2) the final quantum of encoding
  335.       input is exactly 8 bits; here, the final unit  of  encoded  output
  336.       will  be two characters followed by two "=" padding characters, or
  337.       (3) the final quantum of encoding input is exactly 16 bits;  here,
  338.       the final unit of encoded output will be three characters followed
  339.       by one "=" padding character.
  340.  
  341.  
  342.  
  343. Expires: October 31, 1993                                       [Page 6]
  344.  
  345. Internet-Draft          FTP Security Extensions               April 1993
  346.  
  347.  
  348.       Implementors should keep in mind that the  base  64  encodings  in
  349.       ADAT,  MIC,  and  ENC commands, and in 631 and 632 replies, may be
  350.       arbitrarily long.  Thus, the entire string must be read before  it
  351.       can be processed.  Several successive reads on the control channel
  352.       may be necessary.  It is not appropriate to for a server to reject
  353.       a  command  containing a base 64 encoding simply because it is too
  354.       long (assuming that the decoding is otherwise well formed  in  the
  355.       context in which it was sent).
  356.  
  357.       The server will return a 501 reply if the argument  could  not  be
  358.       properly base 64 decoded.
  359.  
  360.       The server will return a 535 reply to any MIC command which  fails
  361.       checksum, replay, sequencing, or other applicable security checks.
  362.  
  363.       There are no other direct replies from MIC or  ENC  commands;  the
  364.       resultant FTP command will generate its own replies.
  365.  
  366.       In environments where the native character set is not  ASCII,  the
  367.       client  must  translate  the  encapsulated command to ASCII before
  368.       passing  it  to  the  protection  routine,  and  the  server  must
  369.       translate  the  encapsulated  command from ASCII after passing the
  370.       token to the protection routine.
  371.  
  372.  
  373.    PRIVACY PROTECTED COMMAND (ENC)
  374.  
  375.       The required argument is a Telnet string consisting of a  base  64
  376.       encoded  "private" message produced by an authentication mechanism
  377.       specific  message  confidentiality  procedure.   The  server  will
  378.       decode   the   received  string,  verify  its  integrity  via  the
  379.       authentication   mechanism   specific   message    confidentiality
  380.       procedure,  and upon success, interpret the resultant string as an
  381.       FTP command.
  382.  
  383.       It is strongly recommended that PASS commands be  sent  under  ENC
  384.       protection, when possible.
  385.  
  386.       The server will return a 501 reply if the argument  could  not  be
  387.       properly base 64 decoded.
  388.  
  389.       The server will return a 535 reply to any ENC command which cannot
  390.       be  properly  decrypted, or fails checksum, replay, sequencing, or
  391.       other applicable security checks.
  392.  
  393.       The server will return a 502 reply if it does not support the  ENC
  394.       command.   In  this  case,  the  client  should retry the enclosed
  395.       command again under MIC protection.
  396.  
  397.  
  398.  
  399.  
  400.  
  401. Expires: October 31, 1993                                       [Page 7]
  402.  
  403. Internet-Draft          FTP Security Extensions               April 1993
  404.  
  405.  
  406.    DATA CHANNEL PROTECTION LEVEL (PROT)
  407.  
  408.       The argument is a single Telnet character code specifying the data
  409.       protection  level.   The  PROT  command  will  be rejected and the
  410.       server will reply 504 if no previous ADAT  command  succeeded,  or
  411.       the  specified protection level is not supported.  Upon success, a
  412.       200 reply will be sent by the  server,  indicating  that  the  new
  413.       protection level is now in effect.
  414.  
  415.       The following codes are assigned for protection levels:
  416.  
  417.  
  418.          C - Clear
  419.          S - Safe
  420.          P - Private
  421.  
  422.  
  423.       The default protection level  is  Safe,  unless  no  ADAT  command
  424.       succeeded,  in  which  case the default protection level is Clear.
  425.       Thus, when an ADAT command succeeds, the protection level  on  the
  426.       client  and  server  changes to Safe without the passing of a PROT
  427.       command.  The Safe protection level is required to be  implemented
  428.       by  all  authentication types, but the Private protection level is
  429.       optional.
  430.  
  431.       When using the Safe protection level, all data sent over the  data
  432.       channel  is  to  be integrity protected by cryptographic checksum.
  433.       When using the Private protection level, all data  sent  over  the
  434.       data channel is to be privacy protected by encryption.  The sender
  435.       will apply protection  services  after  all  data  transformations
  436.       associated  with  the current representation type, file structure,
  437.       and transfer mode have been performed.  The  data  sent  over  the
  438.       data  channel  is,  for  the  purposes  of  data protection, to be
  439.       treated as a byte stream.  An  authentication  mechanism  specific
  440.       data  protection  procedure  will  be  employed  by  the sender to
  441.       protect this byte stream.  The procedure should process  a  buffer
  442.       of  bytes  at  a  time,  and send the result as a stream of bytes,
  443.       prepending each transferred buffer with a four byte  length  field
  444.       (most  significant  byte first).  A minimal implementation must be
  445.       able to handle a buffer length of  at  least  65,536  bytes.   The
  446.       receiver  will read the four byte length field, and then read that
  447.       number of bytes of  protected  data,  passing  the  buffer  to  an
  448.       authentication   mechanism  specific  data  protection  procedure.
  449.       Further  buffers  will  be  similarly  read  and  processed.   Any
  450.       transformations  associated  with the current representation type,
  451.       file structure, and transfer mode would then be performed  on  the
  452.       resultant  data.   When  using  block  transfer mode, the sender's
  453.       (cleartext) buffer size should be equal to the block size.
  454.  
  455.       Under the Clear protection level (i.e., as defined  in  RFC  959),
  456.  
  457.  
  458.  
  459. Expires: October 31, 1993                                       [Page 8]
  460.  
  461. Internet-Draft          FTP Security Extensions               April 1993
  462.  
  463.  
  464.       and  when  in  stream  mode,  the  server indicates end of file by
  465.       closing the data connection.  This is inherently unreliable, since
  466.       the  client  cannot  determine  whether  the connection was closed
  467.       prematurely.   Transferring  files  under  the  Safe  or   Private
  468.       protection  level  allows the server to send a positive indication
  469.       of end of file by sending a protected buffer which  contains  zero
  470.       bytes  of  cleartext  data.   Upon  receipt  of such a zero length
  471.       cleartext buffer, the recipient (client or  server)  should  close
  472.       the  data  connection and consider the file transfer complete.  If
  473.       the connection is closed before such a buffer  is  received,  then
  474.       the  file  transfer  on the client side should be aborted, and the
  475.       user should be alerted.  If the server was the recipient, then  it
  476.       should send a 426 reply in this case.
  477.  
  478.       If any data protection services  fail  at  any  time  during  data
  479.       transfer,  the  server  will send a 435 reply (along with possibly
  480.       other replies indicating the transfer itself failed).
  481.  
  482.  
  483. 4. New FTP Replies
  484.  
  485.    All replies after a successful ADAT command must be protected.  A new
  486.    reply type is introduced for this purpose, indicated by a sixth value
  487.    for the first digit of the reply code:
  488.  
  489.    6yz   Protected reply
  490.  
  491.       The text of this reply is to be decoded and interpreted as an  FTP
  492.       reply (if such decoding is successful).  If the reply code is 631,
  493.       then the text of the reply is  integrity  protected  in  the  same
  494.       manner  as  MIC commands.  If the reply code is 632, then the text
  495.       of the reply is privacy  protected  in  the  same  manner  as  ENC
  496.       commands.   The  security  policy  of the server will dictate when
  497.       such replies are to be used.  The security policy  of  the  client
  498.       will  dictate  whether  other  reply types will be accepted.  As a
  499.       general rule, the server should send a 631 reply to a MIC command,
  500.       and  a  632  reply  to  an  ENC  command.   The  server may send a
  501.       protected reply only if a previous ADAT command succeeded.
  502.  
  503.       If the server for some reason cannot encode the  reply,  then  the
  504.       unprotected  reply will be sent instead.  The server must not send
  505.       632 replies if the client does not support encryption (this should
  506.       be   indicated   by  the  security  context).   If,  upon  context
  507.       establishment,  it  is  not  known  whether  the  client  supports
  508.       encryption, then the server must only send a 632 reply in response
  509.       to an ENC command.
  510.  
  511.       Multi-line replies are handled as follows.  If the server sends  a
  512.       protected  reply  in  which  the  decoded reply has a hyphen ("-")
  513.       immediately following the reply code, then the  server  will  send
  514.  
  515.  
  516.  
  517. Expires: October 31, 1993                                       [Page 9]
  518.  
  519. Internet-Draft          FTP Security Extensions               April 1993
  520.  
  521.  
  522.       the rest of the lines of text of the multi-line reply each encoded
  523.       as the first line was and each followed by the Telnet  end-of-line
  524.       character.   The  last  line  of the multi-line reply will be that
  525.       line which when decoded by the receiver begins  with  the  initial
  526.       reply code followed by a space.  Note that it is the format of the
  527.       decoded  reply,  and  not  the  enclosing  protected  reply,  that
  528.       indicates  a  multi-line  reply.  A hyphen immediately following a
  529.       6xy reply code should be ignored.  The server need not include the
  530.       Telnet end-of-line character within the encoded reply.
  531.  
  532.  
  533. 5. Command Summary
  534.  
  535.    The following is a summary of the commands described  above  (in  BNF
  536.    notation):
  537.  
  538.       AUTH <SP> <auth-type> <CRLF>
  539.       ADAT <SP> <base64string> <CRLF>
  540.       MIC  <SP> <base64string> <CRLF>
  541.       ENC  <SP> <base64string> <CRLF>
  542.       PROT <SP> <protection-level> <CRLF>
  543.  
  544.       The syntax of the above argument fields (using BNF notation where
  545.       applicable) is:
  546.  
  547.       <base64string> ::= <quads> | <quads><terminal>
  548.       <quads> ::= <quad> | <quad><quads>
  549.       <quad> ::= <base64char><base64char><base64char><base64char>
  550.       <base64char> ::= ASCII A through Z
  551.                      | ASCII a through z
  552.                      | ASCII 0 through 9
  553.                      | ASCII +
  554.                      | ASCII /
  555.       <terminal>  ::= <base64char><terminal1><pad><pad>
  556.                     | <base64char><base64char><terminal2><pad>
  557.       <terminal1> ::= ASCII A through D
  558.       <terminal2> ::= ASCII A through P
  559.       <pad>       ::= ASCII =
  560.       <auth-type> ::= <string>
  561.       <string>    ::= <char> | <char><string>
  562.       <char>      ::= any of the 128 ASCII characters except <CR> and <LF>
  563.       <protection-level> ::= C | S | P
  564.  
  565.  
  566.    The following lists the various reply codes for each new command:
  567.  
  568.    AUTH
  569.       234
  570.       334
  571.       500, 501, 503, 504, 421
  572.  
  573.  
  574.  
  575. Expires: October 31, 1993                                      [Page 10]
  576.  
  577. Internet-Draft          FTP Security Extensions               April 1993
  578.  
  579.  
  580.    ADAT
  581.       235
  582.       335
  583.       500, 501, 503, 535, 421
  584.    MIC
  585.       500, 501, 535, 421
  586.    ENC
  587.       500, 501, 502, 535, 421
  588.    PROT
  589.       200
  590.       500, 501, 504, 421, 530
  591.  
  592.    The following are additional reply codes for existing  commands  (502
  593.    is  the  only  reply  for  all  commands except ENC and MIC once ADAT
  594.    succeeds):
  595.  
  596.    USER
  597.       231
  598.       333
  599.    STOR
  600.       435
  601.    STOU
  602.       435
  603.    RETR
  604.       435
  605.    LIST
  606.       435
  607.    NLST
  608.       435
  609.    APPE
  610.       435
  611.  
  612. 6. References
  613.  
  614.  
  615.   [1] Reynolds, Joyce, and Postel, Jon, "File Transfer Protocol  (FTP)",
  616.       RFC 959, ISI, October 1985.
  617.  
  618.   [2] Linn, John, "Privacy Enhancement  for  Internet  Electronic  Mail:
  619.       Part  I:  Message  Encryption  and Authentication Procedures", RFC
  620.       1421, February 1993.
  621.  
  622.   [3] Linn, John, "Generic  Security  Service  API  (GSSAPI)",  Internet
  623.       Draft, November 1992.
  624.  
  625.  
  626. Security Considerations
  627.  
  628.    Third party file transfers cannot be secured using these  extensions,
  629.    since  a  security  context cannot be established between two servers
  630.  
  631.  
  632.  
  633. Expires: October 31, 1993                                      [Page 11]
  634.  
  635. Internet-Draft          FTP Security Extensions               April 1993
  636.  
  637.  
  638.    using these facilities.  Further work in this area is deferred.
  639.  
  640. APPENDIX I:  SPECIFICATION UNDER KERBEROS VERSION 4
  641.  
  642.    The authentication  type  (for  the  AUTH  command)  associated  with
  643.    Kerberos   Version   4   is  KERBEROS_V4.   If  the  server  supports
  644.    KERBEROS_V4, it will respond with a 334 reply code indicating that an
  645.    ADAT command is expected next.
  646.  
  647.    The client should  retrieve  a  ticket  for  the  Kerberos  principal
  648.    "ftp.hostname@realm"  by  calling krb_mk_req(3) with a principal name
  649.    of "ftp", an instance equal to the canonical host name of the  server
  650.    with  all  letters  in  lower  case,  the server's realm name, and an
  651.    arbitrary checksum.  The ticket must then be base 64 encoded and sent
  652.    as the argument to an ADAT command.
  653.  
  654.    The server must base 64 decode the argument to the ADAT  command  and
  655.    pass  the  result  to  krb_rd_req(3).  The server must add one to the
  656.    checksum from the authenticator and encrypt it using  krb_mk_priv(3),
  657.    then  base 64 encode the result.  Upon success, the server must reply
  658.    to the client with a 235 code and include "ADAT=base64string" in  the
  659.    text of the reply.  Upon failure, the server will reply 535.
  660.  
  661.    Upon receipt of the 235 reply from the server, the client must  parse
  662.    the  text  of  the reply for the base 64 encoded data, decode it, and
  663.    pass the result to krb_rd_priv(3).  The client  should  consider  the
  664.    server  authenticated  if the resultant checksum is equal to one plus
  665.    the value previously sent.
  666.  
  667.    The procedure  associated  with  integrity  protected  MIC  commands,
  668.    replies, and Safe file transfers is:
  669.  
  670.       krb_mk_safe(3) for the sender
  671.       krb_rd_safe(3) for the receiver
  672.  
  673.    The  procedure  associated  with  privacy  protected  ENC   commands,
  674.    replies, and Private file transfers is:
  675.  
  676.       krb_mk_priv(3) for the sender
  677.       krb_rd_priv(3) for the receiver
  678.  
  679.  
  680.    Note that this specification for KERBEROS_V4  contains  no  provision
  681.    for  negotiating  alternate  means  for integrity and confidentiality
  682.    routines.  Also, note that the ADAT exchange does not convey  whether
  683.    the peer supports confidentiality services.
  684.  
  685. APPENDIX II: SPECIFICATION UNDER THE GSSAPI
  686.  
  687.    The authentication type (for the AUTH command)  associated  with  all
  688.  
  689.  
  690.  
  691. Expires: October 31, 1993                                      [Page 12]
  692.  
  693. Internet-Draft          FTP Security Extensions               April 1993
  694.  
  695.  
  696.    mechanisms employing the GSSAPI is GSSAPI.  If the server supports an
  697.    authentication mechanism employing the GSSAPI, it will respond with a
  698.    334 reply code indicating that an ADAT command is expected next.
  699.  
  700.    The client  should  begin  the  authentication  exchange  by  calling
  701.    GSS_Init_Sec_Context, passing in NULL for claimant_cred_handle to get
  702.    the default credentials for the user (this is to  avoid  dependencies
  703.    on  names  for  particular  mechanisms),  0  for input_context_handle
  704.    (initially), NULL for mech_type (indicating  "use  default  mechanism
  705.    type"),  and  a  targ_name  of "ftp/hostname" where "hostname" is the
  706.    canonical host name of the server with all  letters  in  lower  case.
  707.    The  output_token must then be base 64 encoded and sent to the server
  708.    as the argument to an ADAT command.  If GSS_Init_Sec_Context  returns
  709.    GSS_CONTINUE_NEEDED,  then  the  client  should  expect a token to be
  710.    returned in the  reply  to  the  ADAT  command.   This  token  should
  711.    subsequently  be  passed to another call to GSS_Init_Sec_Context.  In
  712.    this case, if GSS_Init_Sec_Context returns no output_token, then  the
  713.    reply  code from the server for the previous ADAT command should have
  714.    been 235.  If  GSS_Init_Sec_Context  returns  GSS_COMPLETE,  then  no
  715.    further  tokens  should  be  expected from the server, and the client
  716.    should consider the server authenticated.
  717.  
  718.    The server must base 64 decode the argument to the ADAT  command  and
  719.    pass  the  resultant  token to GSS_Accept_Sec_Context as input_token,
  720.    setting acceptor_cred_handle to NULL (for "use default credentials"),
  721.    and  0  for  input_context_handle (initially).  If an output_token is
  722.    returned, it should be base 64 encoded and returned to the client  by
  723.    including   "ADAT=base64string"   in  the  text  of  the  reply.   If
  724.    GSS_Accept_Sec_Context returns GSS_COMPLETE, the reply code should be
  725.    235,  and  the  server  should consider the client authenticated.  If
  726.    GSS_Accept_Sec_Context returns GSS_CONTINUE_NEEDED,  the  reply  code
  727.    should be 335.  Otherwise, the reply code should be 535.
  728.  
  729.    The procedure  associated  with  integrity  protected  MIC  commands,
  730.    replies, and Safe file transfers is:
  731.  
  732.       GSS_Safe for the sender
  733.       GSS_Verify for the receiver
  734.  
  735.    The  procedure  associated  with  privacy  protected  ENC   commands,
  736.    replies, and Private file transfers is:
  737.  
  738.       GSS_Seal for the sender
  739.       GSS_Unseal for the receiver
  740.  
  741.  
  742.    Both the client and server should inspect the value of conf_avail  to
  743.    determine whether the peer supports confidentiality services.
  744.  
  745. Author's Address:
  746.  
  747.  
  748.  
  749. Expires: October 31, 1993                                      [Page 13]
  750.  
  751. Internet-Draft          FTP Security Extensions               April 1993
  752.  
  753.  
  754.    Steven J. Lunt, Editor
  755.    Bellcore
  756.    RRC-1L213
  757.    444 Hoes Lane
  758.    Piscataway, NJ 08854
  759.  
  760.    Phone: (908) 699-4244
  761.    EMail: lunt@bellcore.com
  762.  
  763.    Mailing List: ftp-wg@tgv.com
  764.  
  765. Chair's Address:
  766.  
  767.    The working group can be contacted via the current chair:
  768.  
  769.    Sam Sjogren
  770.    TGV, Inc.
  771.    603 Mission St.
  772.    Santa Cruz, CA  95060
  773.  
  774.    Phone: (408) 427-4366
  775.    EMail: sjogren@tgv.com
  776.  
  777. Editor's Notes:
  778.  
  779.    This is implemented and working for Kerberos V4 on SunOS 4.1.2  using
  780.    SunOS  source  for ftp and ftpd, and also the BSD Reno source for ftp
  781.    and ftpd.
  782.  
  783.    YET TO BE DONE:
  784.  
  785.  
  786.      1.  The client may fail when processing the ADAT data  from  a  235
  787.          reply,  in  which case the server thinks things are OK, but the
  788.          client thinks otherwise.  Unclear how to proceed at that point,
  789.          other than to drop the connection.
  790.  
  791.      2.  New state diagrams might need to be drawn  for  how  the  AUTH,
  792.          ADAT, USER, and PASS commands now flow.
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807. Expires: October 31, 1993                                      [Page 14]
  808.  
  809.